package com.centaline.androidsalesblog.api.usercenter;

import android.text.TextUtils;

import com.android.volley.Request;
import com.centaline.androidsalesblog.api.UserCenterApi;
import com.centaline.androidsalesblog.model.responseobject.UserRo;
import com.centanet.framework.interfaces.IResponseListener;

/**
 * 登录
 * Created by guilin on 16/1/11.
 */
public class LoginApi extends UserCenterApi<UserRo> {

    private String phone;
    private String passWord;
    private String verificationCode;
    private String sinaAccount;
    private String qqAccount;
    private String weiXinAccount;
    private String thirdLoginPicUrl;
    private String nickName;

    public LoginApi(Class<?> tag, Class<UserRo> aClass, IResponseListener<UserRo> iResponseListener) {
        super(tag, aClass, iResponseListener);
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public void setPassWord(String passWord) {
        this.passWord = passWord;
    }

    public void setVerificationCode(String verificationCode) {
        this.verificationCode = verificationCode;
    }

    public void setSinaAccount(String sinaAccount) {
        this.sinaAccount = sinaAccount;
    }

    public void setQqAccount(String qqAccount) {
        this.qqAccount = qqAccount;
    }

    public void setWeiXinAccount(String weiXinAccount) {
        this.weiXinAccount = weiXinAccount;
    }

    public void setThirdLoginPicUrl(String thirdLoginPicUrl) {
        this.thirdLoginPicUrl = thirdLoginPicUrl;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    @Override
    protected int getMethod() {
        return Request.Method.POST;
    }

    @Override
    protected void setParams() {
        resetParams();
        putStringParams("Phone", phone);
        putStringParams("PassWord", passWord);
        if (!TextUtils.isEmpty(verificationCode)) {
            putParams("VerificationCode", verificationCode);
        }
        putParams("AppNo", "APP");
        putStringParams("SinaAccount", sinaAccount);
        putStringParams("QQAccount", qqAccount);
        putStringParams("WeiXinAccount", weiXinAccount);
        putStringParams("ThirdLoginPicUrl", thirdLoginPicUrl);
        putStringParams("NickName", nickName);
    }

    @Override
    protected String getPath() {
        return "UserLogin2Request";
    }
}
